﻿using System.Windows.Forms;
using Com.OpenCode.Framework.Core;
using Com.OpenCode.Framework.DevForm;

namespace Com.OpenCode.Framework.Workbench
{
    public class MainFormDoozer : IDoozer
    {
        public string Name
        {
            get { return "MainForm"; }
        }

        public object BuildItem(BuildItemEventArgs args)
        {
            MainForm _AddInForm = new MainForm(args);
            Plugin menuPlugin = args.Plugin.Search("Menu");
            if (menuPlugin != null)
            {
                args.Plugin.Addin.Bulid(menuPlugin, _AddInForm);
            }
            RibbonUI.Instanse.CheckVisible();
            Plugin statusPlugin = args.Plugin.Search("StatusBar");
            if (statusPlugin != null)
            {
                args.Plugin.Addin.Bulid(statusPlugin, _AddInForm);
            }
            _AddInForm.StartPosition = FormStartPosition.CenterScreen;
            _AddInForm.Show();
            _AddInForm.Visible = false;
            return _AddInForm;
        }
    }
}